package com.xzavier.yunlian_interview.utils;

import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
public class JsonResult<E> implements Serializable {
    /*
    状态码
     */
    private Integer code;
    /**
     * 描述信息
     */
    private String message;
    /*
    数据 E是泛型
     */
    private E data;

    public JsonResult(Integer code) {
        this.code = code;
    }

    public JsonResult(Throwable e) {
        this.message = e.getMessage();
    }

    public JsonResult(Integer code, E data) {
        this.code = code;
        this.data = data;
    }
}

